//
//  PushWebViewVC.m
//  Zaker
//
//  Created by 赵磊 on 16/3/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "PushWebViewVC.h"

@interface PushWebViewVC ()<UIWebViewDelegate>
@property (nonatomic, retain) UIActivityIndicatorView *activity;
@property(nonatomic,retain)UIWebView *wv;
@end

@implementation PushWebViewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.wv = [[UIWebView alloc] initWithFrame:CGRectMake(0, -40, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height + 30)];
    /**<  取消回弹效果 */
    self.wv.scrollView.bounces = NO;
    self.wv.delegate = self;
  /**加载网址*/
    [self.wv loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.pathstr]]];
    [self.view addSubview:self.wv];
    [self createActivity];
}
- (void) createActivity
{
    self.activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    self.activity.color = [UIColor blackColor];
    self.activity.center = self.view.center;
    [self.view addSubview:self.activity];
}

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [self.activity startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.activity stopAnimating];
    CGFloat height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] floatValue];
    self.wv.scrollView.contentSize = CGSizeMake(self.view.frame.size.width - 100 * WIDTH * 375 , height);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
